#ifndef FND_GAME_2D_TILE_ACTOR_HPP
#define FND_GAME_2D_TILE_ACTOR_HPP
#include "mover.hpp"
#include <sfml/graphics.hpp>
namespace FndGame2D {
  class quad_actor : public mover {
  public:
    quad_actor(const std::string& name = std::string(), int draw_level = 0,
	       const mover::position_type& p = mover::position_type(),
	       float angle = 0.0f) ;
    ~quad_actor() {if( m_sprite) delete m_sprite ; m_sprite = 0 ;}
    static const std::string SET_IMAGE ;
    static const std::string SET_RECT ;
    virtual sf::FloatRect bounding_box()const ;
    virtual int width() const {return m_sprite->GetSubRect().GetWidth() ;}
    virtual int height() const {return m_sprite->GetSubRect().GetHeight() ;}
  protected:
    void quad_defalut_render(sf::RenderTarget& w) ; 
    void set_rect(const sf::IntRect& rect) {m_sprite->SetSubRect(rect) ;}
    void set_image(const sf::Image& img) {m_sprite->SetImage(img) ;}
  private:
    sf::Sprite* m_sprite ;
  private:
    void update_pos_and_rotation(float) {update_pos() ;update_rotation();}
    void update_pos() {m_sprite->SetPosition(x(),y()) ;}
    void update_rotation() {m_sprite->SetRotation(angle());}
    bool handle_set_image_message(const normal_thinker_message_type& msg) ;
    bool handle_set_quad_message(const normal_thinker_message_type& msg) ;
  } ;
}

#endif
